#include <stdio.h>

int sumArray(int arr[], int n) {
	int sum = 0;
	for (int i = 0; i < n; i++) {
		//sum += arr[i];
		//sum += i[arr];
		sum += *(arr + i);
	}
	return sum;
}

int main12() {
	int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
	int sum = 0;
	for (int* p = &arr[0]; p < &arr[10]; p++) {
		sum += *p;
	}
	printf(" sum==%d\n", sum);

	sum = 0;
	for (int i = 0; i < 10; i++) {
		sum += arr[i];
	}
	printf(" sum==%d\n", sum);

	sum = 0;
	int* p = &arr[0];
	while (p<&arr[10])
	{
		sum += *p++;
	}
	printf(" sum==%d\n", sum);

	sum = 0;
	for (int* p = arr; p < arr + 10; p++) {
		sum += *p;
	}
	printf(" sum==%d\n", sum);
	sum = 0;
	int* p2 = arr;
	for (int i = 0; i < 10; i++) {
		sum += p2[i];
	}
	printf(" sum==%d\n", sum);

	printf(" sumArr==%d\n", sumArray(arr,10));
	return 0;
}